import instance from "./request";
import qs from "qs"
//这个文件用来统一管理项目中所有的API链接

//首页精品推荐的请求和精品推荐
export const JinpinAPI = () => instance.get("/products/recommend")
export const ReMenAPI = () => instance.get("/products/hot")


//发送短信验证码请求
export const SendSMSAPI = (params) => instance.post("/sendSMS", qs.stringify(params))

//手机号验证码登录（含注册）/phoneRegin
export const PhoneReginAPI = (params) => instance.post("/phoneRegin", qs.stringify(params))

// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginAPI = (params) => instance.post('/wechatUsers/PCLogin', qs.stringify(params));

// 手机号绑定微信
export const bingPhoneAPI = (params) => instance.post('/wechatUsers/binding', qs.stringify(params));

// 获取登录用户信息
export const UserProfilesAPI = () => instance.get("/shop/userProfiles");

//商品详情
export const GoodDetailsAPI = (id) => instance.get(`/products/${id}`);

//加入到购物车
export const addToCartAPI = (params) => instance.post('/shop/carts/add', qs.stringify(params));

// 商品搜索（含首页的“更多”）
export const GoodsSearchApi = (params) => instance.get('/products', { params });